package com.hxb.ruifeng.controller;


import com.hxb.ruifeng.entity.Result;
import com.hxb.ruifeng.entity.vo.LoginVo;
import com.hxb.ruifeng.service.impl.UserServiceImpl;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HXB
 * @since 2024-01-07
 */
@RestController
@RequestMapping("/user")
@ApiModel(value="User对象", description="用户控制类")
public class UserController extends BaseController{

    @Autowired
    private UserServiceImpl userServiceImpl;

    @PostMapping ("/login")
    @ApiOperation(value = "登录")
    public Result<?> login(@RequestBody LoginVo loginVo){
        return userServiceImpl.loginUser(loginVo);
    }

    @GetMapping("/userDate")
    @ApiOperation(value = "获取用户信息")
    public Result<?> userDate(){
        return userServiceImpl.getUserData(loginUser().getId());
    }
}

